package com.coolbi.onsupai.core.biz.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.coolbi.onsupai.core.biz.InvoiceBiz;
import com.coolbi.onsupai.core.dao.InvoiceDao;
import com.coolbi.onsupai.core.entity.Invoice;
import com.coolbi.onsupai.core.exception.ServiceException;

public class InvoiceBizImpl implements InvoiceBiz {

	@Autowired
	private InvoiceDao invoiceDao;
	public void setInvoiceDao(InvoiceDao invoiceDao) {
		this.invoiceDao = invoiceDao;
	}
	
	@Override
	public Invoice save(Invoice obj) {
		try {
			invoiceDao.save(obj);
		} catch (Exception e) {
			throw new ServiceException("录入发票信息发生错误！", e);
		}
		return obj;
	}

	@Override
	public void delete(long id) {
		try {
			invoiceDao.delete(id);
		} catch (Exception e) {
			throw new ServiceException("删除发票信息发生错误！", e);
		}
	}

	@Override
	public void update(Invoice obj) {
		try {
			invoiceDao.update(obj);
		} catch (Exception e) {
			throw new ServiceException("修改发票信息发生错误！", e);
		}
	}

	@Override
	public Invoice get(long id) {
		return invoiceDao.get(id);
	}

	@Override
	public List<Invoice> list() {
		return invoiceDao.list();
	}

	@Override
	public List<Invoice> listByPage(int offset, int limit) {
		return invoiceDao.listByPage(offset, limit);
	}

	@Override
	public List<Invoice> find(Map<String, Object> parameter) {
		return invoiceDao.find(parameter);
	}

	@Override
	public List<Invoice> findByPage(Map<String, Object> parameter, int offset,
			int limit) {
		return invoiceDao.findByPage(parameter, offset, limit);
	}

	@Override
	public List<Invoice> search(Map<String, Object> parameter, int offset,
			int limit) {
		return invoiceDao.search(parameter, offset, limit);
	}

	@Override
	public int count() {
		return invoiceDao.count();
	}

	@Override
	public int countByKeyWord(Map<String, Object> parameter) {
		return invoiceDao.countByKeyWord(parameter);
	}

	@Override
	public int count(Map<String, Object> parameter) {
		return invoiceDao.count(parameter);
	}

}
